-
Notifications
You must be signed in to change notification settings - Fork 0
Profiling example #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR sets up experiments for profiling the Arc Unwrapping algorithm using both loop‐based and Dask-based methods, as described in issue #88. Key changes include:
- Adding a Dask-based unwrapping implementation (both script and notebook versions) to leverage parallel processing.
- Including a loop-based unwrapping implementation (script and notebook) for baseline comparison.
- Updating documentation in the README to describe profiling procedures and commands.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
File | Description |
---|---|
profiling_example/lambda_unwrap_dask.py | Adds a Dask-based parallel unwrapping script with process‐based scheduling. |
profiling_example/lambda_unwrap_dask.ipynb | Introduces a Jupyter notebook for debugging/visualizing the Dask-based implementation. |
profiling_example/lambda.py | Provides a loop-based unwrapping script for direct unwrapping execution. |
profiling_example/lambda.ipynb | Contains a notebook version of the loop-based unwrapping method for analysis. |
profiling_example/README.md | Updates documentation to explain profiling experiments using both approaches. |
Co-authored-by: Copilot <[email protected]>
Hi @fnattino, in this PR I setup the profiling experiment. The explaination of the files should be in README, including a link to the results. I put the discussion of the results in this discussion channel . Can you review on the profiling method? Thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @rogerkuou, looks good! I think the instructions on how to setup the profiler are very clear.
Only very small suggestions from my side, the main one being that the pyspy-speedscope outputs are in JSON format.
With respect to the results of the benchmark, maybe it is not surprising that the Dask implementation essentially does not give any improvement.
The initial benchmark seems to suggest a lot of time is spent as overhead in small np call. With the for loop and most of the time being spent within the Python interpreter (i.e. not within numpy functions, which release the GIL) the threading approach cannot give any benefit. Not sure about the processing approach, but it probably suffers from the overhead of the data being transferred from the main process to the workers and back..
py-spy record --output profile_loop_60pnts --idle --rate 5 --subprocesses --format speedscope python lambda_unwrap.py | ||
``` | ||
|
||
### Dask with `processes` schedular: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
### Dask with `processes` schedular: | |
### Dask with `processes` scheduler: |
py-spy record --output profile_dask_60pnts_processes --idle --rate 5 --subprocesses --format speedscope python lambda_unwrap_dask.py | ||
``` | ||
|
||
### Dask with `threads` schedular: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
### Dask with `threads` schedular: | |
### Dask with `threads` scheduler: |
### Loop method | ||
|
||
```sh | ||
py-spy record --output profile_loop_60pnts --idle --rate 5 --subprocesses --format speedscope python lambda_unwrap.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
py-spy record --output profile_loop_60pnts --idle --rate 5 --subprocesses --format speedscope python lambda_unwrap.py | |
py-spy record --output profile_loop_60pnts.json --idle --rate 5 --subprocesses --format speedscope python lambda_unwrap.py |
``` | ||
|
||
```sh | ||
py-spy record --output profile_dask_60pnts_processes --idle --rate 5 --subprocesses --format speedscope python lambda_unwrap_dask.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
py-spy record --output profile_dask_60pnts_processes --idle --rate 5 --subprocesses --format speedscope python lambda_unwrap_dask.py | |
py-spy record --output profile_dask_60pnts_processes.json --idle --rate 5 --subprocesses --format speedscope python lambda_unwrap_dask.py |
``` | ||
|
||
```sh | ||
py-spy record --output profile_dask_60pnts_threads --idle --rate 5 --subprocesses --format speedscope python lambda_unwrap_dask.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
py-spy record --output profile_dask_60pnts_threads --idle --rate 5 --subprocesses --format speedscope python lambda_unwrap_dask.py | |
py-spy record --output profile_dask_60pnts_threads.json --idle --rate 5 --subprocesses --format speedscope python lambda_unwrap_dask.py |
py-spy record --output profile_dask_60pnts_threads --idle --rate 5 --subprocesses --format speedscope python lambda_unwrap_dask.py | ||
``` | ||
|
||
Then you can visualize the profile using the [`speedscope` web tool](https://www.speedscope.app/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then you can visualize the profile using the [`speedscope` web tool](https://www.speedscope.app/) | |
Then you can visualize the profiling results using the [`speedscope` web tool](https://www.speedscope.app/) by uploading the corresponding JSON file. |
Set up experiments for profiling, as required in https://github.com/TUDelftGeodesy/DePSI_group/issues/88